import com.aliyun.vod.upload.impl.UploadVideoImpl;
import com.aliyun.vod.upload.req.UploadVideoRequest;
import com.aliyun.vod.upload.resp.UploadVideoResponse;

/**
 * Description:
 *
 * @Autor: Rolin
 * datetime: 05-27-11:11
 */
public class UploadVideo {

    //账号AK信息请填写(必选)
    private static final String accessKeyId = "LTAI5tLGmiu1XYytf5qGgnTY";
    //账号AK信息请填写(必选)
    private static final String accessKeySecret = "aJEQqXGGSxjOWxsP75YaJ25lZDFgAU";

    public static void main(String[] args) {

        String title = "test5";
        String fileName = "C:\\Users\\22013\\Desktop\\guli-front\\video\\test5.mp4";

        UploadVideoRequest request = new UploadVideoRequest(accessKeyId, accessKeySecret, title, fileName);
        request.setPartSize(1 * 1024 * 1024L);
        request.setTaskNum(1);
        request.setEnableCheckpoint(false);

        UploadVideoImpl uploader = new UploadVideoImpl();
        UploadVideoResponse response = uploader.uploadVideo(request);
        System.out.print("RequestId=" + response.getRequestId() + "\n");


        if (response.isSuccess()) {
            System.out.print("VideoId=" + response.getVideoId() + "\n");
        } else {        /* 如果设置回调URL无效，不影响视频上传，可以返回VideoId同时会返回错误码。其他情 况上传失败时，VideoId为空，此时需要根据返回错误码分析具体错误原因 */
            System.out.print("VideoId=" + response.getVideoId() + "\n");
            System.out.print("ErrorCode=" + response.getCode() + "\n");
            System.out.print("ErrorMessage=" + response.getMessage() + "\n");
        }
    }
}
